{extend name="base" /} {block name="css"}
<link rel="stylesheet" href="__CSS__/custom.css"> {/block} {block name="body"}

<form class="layui-form">
    <!-- 提示：如果你不想用form，你可以换成div等任何一个普通元素 -->
    <div class="layui-form-item" style="margin-left: 900px;">
        <label class="layui-form-label">输入框</label>
        <div class="layui-input-block">
                <input  type="file" name="file" class="layui-upload-file">
        </div>
    </div>
    
</form>


{/block} {block name="script"}
<script>
    layui.use('form', function () {
        var form = layui.form();

        //各种基于事件的操作，下面会有进一步介绍
    });

    layui.use('upload', function () {
        layui.upload({
            url: 'api/upload/uploadwxheadimg',
            before: function (input) {
                //返回的参数item，即为当前的input DOM对象
                console.log('文件上传中');
            },
            success: function (res) {
                console.log('上传完毕');
            }
        });
    });
</script>


{/block}